-
Notifications
You must be signed in to change notification settings - Fork 25
fix: CN-482 use correct falsy checks #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍
|
| } | ||
|
|
||
| if (pkg.epoch) { | ||
| if (pkg.epoch !== undefined && pkg.epoch !== null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this handle pkg.epoch = 0 correctly? I'm not too familiar with the dumpster fire wonderful joy that is true/false checks in JS, and I'm also not familiar with the pkg.epoch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard this, I need to learn to read the full PR message before looking at the code
| } | ||
|
|
||
| if (pkg.epoch) { | ||
| if (pkg.epoch !== undefined && pkg.epoch !== null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/snyk/rpm-parser/blob/39c308effb038b5be0f2de4c4e2c9c8dd18b9dcb/lib/index.ts#L56 formatRpmVersion omits the epoch if it's 0, do you think it would need any update to match the purl?
What does this PR do?
javascript interprets the number 0 as falsy, but 0 is the default epoch for rpm packages; this means that any time we have an rpm package with epoch 0, we just throw it straight in the garbage.
What are the relevant tickets?
https://snyksec.atlassian.net/browse/CN-482